package com.zmn.oms.zmn.aop;

import com.zmn.oms.common.annotation.ZsMemberOrderWorkLog;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;


/**
 * 类描述：会员日志记录
 *
 * @author lujia
 * @date 2018/12/04 20:59
 */

@Aspect
@Component
public class ZsMemberOrderWorkLogAspect extends OrderWorkBaseLogAspect {

    /**
     * 设定切入点
     */
    @Pointcut("@annotation(com.zmn.oms.common.annotation.ZsMemberOrderWorkLog)")
    private void pointCutMethod() {
    }

    @Around("pointCutMethod() && @annotation(zsMemberOrderWorkLog)")
    public Object doMemberLog(ProceedingJoinPoint joinPoint, ZsMemberOrderWorkLog zsMemberOrderWorkLog) throws Throwable {

        // 操作类型
        int logType = zsMemberOrderWorkLog.type();
        boolean beforeProceed = zsMemberOrderWorkLog.beforeProceed();
        boolean handleLog = zsMemberOrderWorkLog.handleLog();

        return super.doLog(joinPoint, logType, beforeProceed, handleLog);
    }

}
